<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>员工绩效管理</title>
	<meta name="decorator" content="default"/>
	 <style type="text/css">
	 	.ui-table-reflow td, .ui-table-reflow th{
			text-align: center;
		 }
	</style>
	<script type="text/javascript">
		global.loginPassword = "${fns:getLoginPw()}";
		$(document).ready(function() {
			$("#searchForm").validate({
				submitHandler: function(form){
					var startValue = $("#startDate").val();
					if (!startValue){
						showTip("开始日期必须填写!");
						return;
					}
					var endValue = $("#endDate").val();
					if (!endValue){
						showTip("结束日期必须填写!");
						return;
					}
					if(startValue && endValue){
						 var start = new Date(startValue.replace(/-/g, "/"));
						 var end = new Date(endValue.replace(/-/g, "/"));
						 if (end < start) {
							showTip("结束日期不能大于开始日期!");
							return;
						}
					}
					var submit = function(){
						form.submit();
		            }
					loginPasswordPopup(submit);
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			$("#contentTable tbody tr").click(function(){
				$("#contentTable tbody tr").removeClass("select_active");
				$(this).addClass("select_active");
			});
			$("#contentTable tbody tr:first-child").click();
		});
	</script>
</head>
<body>
	<div class="icon-buttons">
		<a data-role="button" data-inline="true" data-icon="back" data-iconpos="notext"  href="${ctx}">返回</a>
	</div>
	<form:form id="searchForm" modelAttribute="storeEmployeeAccounting" action="${ctx}/employee/storeEmployeeAccounting/performance" method="post">
		<label>开始日期：</label>
		<input type="date" id="startDate" data-inline="true" name="startDate" value="${startDate}"/>
		<label>结束日期：</label>
		<input type="date" id="endDate" data-inline="true" name="endDate" value="${endDate}"/>
		<input id="btnSubmit" type="submit" value="绩效查询" data-inline="true"/>
	</form:form>
	<tags:message content="${message}"/>
	<table id="contentTable" data-role="table" class="ui-responsive table-stroke">
		<thead><tr><th>员工名称</th><th>职务</th><th>新开卡合计</th><th>产品销售合计</th><th>面部护理合计</th><th>身体护理合计</th><th>仪器护理合计</th><th>卡充值合计</th><th>合计</th></tr></thead>
		<tbody>
		<c:forEach items="${list}" var="detail">
			<tr>
				<td>${detail.employee.name}</td>
				<td>${detail.employee.storeRole.name}</td>
				<td>${detail.new_card_cost}</td>
				<td>${detail.product_sale_cost}</td>
				<td>${detail.face_care_cost}</td>
				<td>${detail.body_care_cost}</td>
				<td>${detail.device_care_cost}</td>
				<td>${detail.recharge_card_cost}</td>
				<td>${detail.total}</td>
			</tr>
		</c:forEach>
		<tr><th colspan="8">合计</th><th>${allMoney}</th></tr>
		</tbody>
	</table>
</body>
</html>
